Optimal. Leaf size=73 \[ -\frac {i x^2}{b}-\frac {x^3}{3}+\frac {2 x \log \left (1+e^{2 i (a+b x)}\right )}{b^2}-\frac {i \text {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{b^3}+\frac {x^2 \tan (a+b x)}{b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3801, 3800,
2221, 2317, 2438, 30} \begin {gather*} -\frac {i \text {Li}_2\left (-e^{2 i (a+b x)}\right )}{b^3}+\frac {2 x \log \left (1+e^{2 i (a+b x)}\right )}{b^2}+\frac {x^2 \tan (a+b x)}{b}-\frac {i x^2}{b}-\frac {x^3}{3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 30
Rule 2221
Rule 2317
Rule 2438
Rule 3800
Rule 3801
Rubi steps
\begin {align*} \int x^2 \tan ^2(a+b x) \, dx &=\frac {x^2 \tan (a+b x)}{b}-\frac {2 \int x \tan (a+b x) \, dx}{b}-\int x^2 \, dx\\ &=-\frac {i x^2}{b}-\frac {x^3}{3}+\frac {x^2 \tan (a+b x)}{b}+\frac {(4 i) \int \frac {e^{2 i (a+b x)} x}{1+e^{2 i (a+b x)}} \, dx}{b}\\ &=-\frac {i x^2}{b}-\frac {x^3}{3}+\frac {2 x \log \left (1+e^{2 i (a+b x)}\right )}{b^2}+\frac {x^2 \tan (a+b x)}{b}-\frac {2 \int \log \left (1+e^{2 i (a+b x)}\right ) \, dx}{b^2}\\ &=-\frac {i x^2}{b}-\frac {x^3}{3}+\frac {2 x \log \left (1+e^{2 i (a+b x)}\right )}{b^2}+\frac {x^2 \tan (a+b x)}{b}+\frac {i \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i (a+b x)}\right )}{b^3}\\ &=-\frac {i x^2}{b}-\frac {x^3}{3}+\frac {2 x \log \left (1+e^{2 i (a+b x)}\right )}{b^2}-\frac {i \text {Li}_2\left (-e^{2 i (a+b x)}\right )}{b^3}+\frac {x^2 \tan (a+b x)}{b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(189\) vs. \(2(73)=146\).
time = 6.16, size = 189, normalized size = 2.59 \begin {gather*} -\frac {x^3}{3}+\frac {\csc (a) \left (b^2 e^{-i \text {ArcTan}(\cot (a))} x^2-\frac {\cot (a) \left (i b x (-\pi -2 \text {ArcTan}(\cot (a)))-\pi \log \left (1+e^{-2 i b x}\right )-2 (b x-\text {ArcTan}(\cot (a))) \log \left (1-e^{2 i (b x-\text {ArcTan}(\cot (a)))}\right )+\pi \log (\cos (b x))-2 \text {ArcTan}(\cot (a)) \log (\sin (b x-\text {ArcTan}(\cot (a))))+i \text {PolyLog}\left (2,e^{2 i (b x-\text {ArcTan}(\cot (a)))}\right )\right )}{\sqrt {1+\cot ^2(a)}}\right ) \sec (a)}{b^3 \sqrt {\csc ^2(a) \left (\cos ^2(a)+\sin ^2(a)\right )}}+\frac {x^2 \sec (a) \sec (a+b x) \sin (b x)}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.09, size = 108, normalized size = 1.48
method | result | size |
risch | \(-\frac {x^{3}}{3}+\frac {2 i x^{2}}{b \left ({\mathrm e}^{2 i \left (b x +a \right )}+1\right )}-\frac {2 i x^{2}}{b}-\frac {4 i a x}{b^{2}}-\frac {2 i a^{2}}{b^{3}}+\frac {2 x \ln \left ({\mathrm e}^{2 i \left (b x +a \right )}+1\right )}{b^{2}}-\frac {i \polylog \left (2, -{\mathrm e}^{2 i \left (b x +a \right )}\right )}{b^{3}}+\frac {4 a \ln \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}\) | \(108\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 257 vs. \(2 (62) = 124\).
time = 0.61, size = 257, normalized size = 3.52 \begin {gather*} \frac {i \, b^{3} x^{3} + 6 \, {\left (b x \cos \left (2 \, b x + 2 \, a\right ) + i \, b x \sin \left (2 \, b x + 2 \, a\right ) + b x\right )} \arctan \left (\sin \left (2 \, b x + 2 \, a\right ), \cos \left (2 \, b x + 2 \, a\right ) + 1\right ) + {\left (i \, b^{3} x^{3} - 6 \, b^{2} x^{2}\right )} \cos \left (2 \, b x + 2 \, a\right ) - 3 \, {\left (\cos \left (2 \, b x + 2 \, a\right ) + i \, \sin \left (2 \, b x + 2 \, a\right ) + 1\right )} {\rm Li}_2\left (-e^{\left (2 i \, b x + 2 i \, a\right )}\right ) - 3 \, {\left (i \, b x \cos \left (2 \, b x + 2 \, a\right ) - b x \sin \left (2 \, b x + 2 \, a\right ) + i \, b x\right )} \log \left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right ) - {\left (b^{3} x^{3} + 6 i \, b^{2} x^{2}\right )} \sin \left (2 \, b x + 2 \, a\right )}{-3 i \, b^{3} \cos \left (2 \, b x + 2 \, a\right ) + 3 \, b^{3} \sin \left (2 \, b x + 2 \, a\right ) - 3 i \, b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 144 vs. \(2 (62) = 124\).
time = 0.40, size = 144, normalized size = 1.97 \begin {gather*} -\frac {2 \, b^{3} x^{3} - 6 \, b^{2} x^{2} \tan \left (b x + a\right ) - 6 \, b x \log \left (-\frac {2 \, {\left (i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1}\right ) - 6 \, b x \log \left (-\frac {2 \, {\left (-i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1}\right ) - 3 i \, {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1} + 1\right ) + 3 i \, {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1} + 1\right )}{6 \, b^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int x^{2} \tan ^{2}{\left (a + b x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int x^2\,{\mathrm {tan}\left (a+b\,x\right )}^2 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________